﻿/*
    This software is licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

    Copyright (C) 2010 Daniel Deptford (redmercury@gmail.com)
 
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:

        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace COLLADASharp.Core
{
    [DAEClass("animation")]
    public class Animation : IDDAENode
    {
        [DAEAttribute("name")]
        [DAENodeProperty("Name", typeof(string))]
        private static NodeProperty nameProperty;
        public string Name
        {
            get { return GetValue(nameProperty) as string; }
            set { SetValue(nameProperty, value); }
        }

        [DAEElement(typeof(Asset), 0)]
        [DAENodeProperty("Asset", typeof(Asset))]
        private static NodeProperty assetProperty;
        public Asset Asset
        {
            get { return GetValue(assetProperty) as Asset; }
            set { SetValue(assetProperty, value); }
        }

        [DAEElement(typeof(Animation), 1)]
        [DAENodeProperty("Animations", typeof(DAENodeList<Animation>))]
        private static NodeProperty animationsProperty;
        public DAENodeList<Animation> Animations
        {
            get { return GetValue(animationsProperty) as DAENodeList<Animation>; }
            set { SetValue(animationsProperty, value); }
        }

        [DAEElement(typeof(Source), 2)]
        [DAENodeProperty("Sources", typeof(DAENodeList<Source>))]
        private static NodeProperty sourceProperty;
        public DAENodeList<Source> Sources
        {
            get { return GetValue(sourceProperty) as DAENodeList<Source>; }
            set { SetValue(sourceProperty, value); }
        }

        [DAEElement(typeof(Sampler), 3)]
        [DAENodeProperty("Samplers", typeof(DAENodeList<Sampler>))]
        private static NodeProperty samplerProperty;
        public DAENodeList<Sampler> Samplers
        {
            get { return GetValue(samplerProperty) as DAENodeList<Sampler>; }
            set { SetValue(samplerProperty, value); }
        }

        [DAEElement(typeof(Channel), 4)]
        [DAENodeProperty("Channels", typeof(DAENodeList<Channel>))]
        private static NodeProperty channelProperty;
        public DAENodeList<Channel> Channels
        {
            get { return GetValue(channelProperty) as DAENodeList<Channel>; }
            set { SetValue(channelProperty, value); }
        }

        [DAEElement(typeof(Extra), 5)]
        [DAENodeProperty("Extra", typeof(Extra))]
        private static NodeProperty extraProperty;
        public Extra Extra
        {
            get { return GetValue(extraProperty) as Extra; }
            set { SetValue(extraProperty, value); }
        }
    }

    [DAEClass("animation_clip")]
    public class AnimationClip : IDDAENode
    {
        [DAEAttribute("name")]
        [DAENodeProperty("Name", typeof(string))]
        private static NodeProperty nameProperty;
        public string Name
        {
            get { return GetValue(nameProperty) as string; }
            set { SetValue(nameProperty, value); }
        }

        [DAEAttribute("start")]
        [DAENodeProperty("Start", typeof(double), 0.0)]
        private static NodeProperty startProperty;
        public double Start
        {
            get { return (double)GetValue(startProperty); }
            set { SetValue(startProperty, value); }
        }

        [DAEAttribute("end")]
        [DAENodeProperty("End", typeof(double), 0.0)]
        private static NodeProperty endProperty;
        public double End
        {
            get { return (double)GetValue(endProperty); }
            set { SetValue(endProperty, value); }
        }

        [DAEElement(typeof(Asset), 0)]
        [DAENodeProperty("Asset", typeof(Asset))]
        private static NodeProperty assetProperty;
        public Asset Asset
        {
            get { return GetValue(assetProperty) as Asset; }
            set { SetValue(assetProperty, value); }
        }

        [DAEElement(typeof(InstanceAnimation), 1)]
        [DAENodeProperty("InstanceAnimations", typeof(DAENodeList<InstanceAnimation>))]
        private static NodeProperty instanceAnimationsProperty;
        public DAENodeList<InstanceAnimation> InstanceAnimations
        {
            get { return GetValue(instanceAnimationsProperty) as DAENodeList<InstanceAnimation>; }
            set { SetValue(instanceAnimationsProperty, value); }
        }

        [DAEElement(typeof(Extra), 2)]
        [DAENodeProperty("Extra", typeof(Extra))]
        private static NodeProperty extraProperty;
        public Extra Extra
        {
            get { return GetValue(extraProperty) as Extra; }
            set { SetValue(extraProperty, value); }
        }
    }

    [DAEClass("channel")]
    public class Channel : DAENode
    {
        [DAEAttribute("source")]
        [DAENodeProperty("Source", typeof(string))]
        private static NodeProperty sourceProperty;
        public string Source
        {
            get { return (string)GetValue(sourceProperty); }
            set { SetValue(sourceProperty, value); }
        }

        [DAEAttribute("target")]
        [DAENodeProperty("Target", typeof(string))]
        private static NodeProperty targetProperty;
        public string Target
        {
            get { return (string)GetValue(targetProperty); }
            set { SetValue(targetProperty, value); }
        }
    }

    [DAEClass("instance_animation")]
    public class InstanceAnimation : SIDDAENode
    {
        [DAEAttribute("name")]
        [DAENodeProperty("Name", typeof(string))]
        private static NodeProperty nameProperty;
        public string Name
        {
            get { return GetValue(nameProperty) as string; }
            set { SetValue(nameProperty, value); }
        }

        [DAEAttribute("url")]
        [DAENodeProperty("Url", typeof(Url))]
        private static NodeProperty urlProperty;
        public Url Url
        {
            get { return GetValue(urlProperty) as Url; }
            set { SetValue(urlProperty, value); }
        }

        [DAEElement(typeof(Extra), 0)]
        [DAENodeProperty("Extra", typeof(Extra))]
        private static NodeProperty extraProperty;
        public Extra Extra
        {
            get { return GetValue(extraProperty) as Extra; }
            set { SetValue(extraProperty, value); }
        }
    }

    [DAEClass("library_animation_clips")]
    public class LibraryAnimationClips : Library
    {
        [DAEElement(typeof(Asset), 0)]
        [DAENodeProperty("Asset", typeof(Asset))]
        private static NodeProperty assetProperty;
        public Asset Asset
        {
            get { return GetValue(assetProperty) as Asset; }
            set { SetValue(assetProperty, value); }
        }

        [DAEElement(typeof(AnimationClip), 1)]
        [DAENodeProperty("AnimationClips", typeof(DAENodeList<AnimationClip>))]
        private static NodeProperty animationClipsProperty;
        public DAENodeList<AnimationClip> AnimationClips
        {
            get { return GetValue(animationClipsProperty) as DAENodeList<AnimationClip>; }
            set { SetValue(animationClipsProperty, value); }
        }
        
        [DAEElement(typeof(Extra), 2)]
        [DAENodeProperty("Extra", typeof(Extra))]
        private static NodeProperty extraProperty;
        public Extra Extra
        {
            get { return GetValue(extraProperty) as Extra; }
            set { SetValue(extraProperty, value); }
        }
    }

    [DAEClass("library_animations")]
    public class LibraryAnimations : Library
    {
        [DAEElement(typeof(Asset), 0)]
        [DAENodeProperty("Asset", typeof(Asset))]
        private static NodeProperty assetProperty;
        public Asset Asset
        {
            get { return GetValue(assetProperty) as Asset; }
            set { SetValue(assetProperty, value); }
        }

        [DAEElement(typeof(Animation), 1)]
        [DAENodeProperty("Animations", typeof(DAENodeList<Animation>))]
        private static NodeProperty animationsProperty;
        public DAENodeList<Animation> Animations
        {
            get { return GetValue(animationsProperty) as DAENodeList<Animation>; }
            set { SetValue(animationsProperty, value); }
        }

        [DAEElement(typeof(Extra), 2)]
        [DAENodeProperty("Extra", typeof(Extra))]
        private static NodeProperty extraProperty;
        public Extra Extra
        {
            get { return GetValue(extraProperty) as Extra; }
            set { SetValue(extraProperty, value); }
        }
    }


    [DAEClass("sampler")]
    public class Sampler : IDDAENode
    {
        [DAEElement(typeof(Input), 0)]
        [DAENodeProperty("Inputs", typeof(DAENodeList<Input>))]
        private static NodeProperty inputsProperty;
        public DAENodeList<Input> Inputs
        {
            get { return GetValue(inputsProperty) as DAENodeList<Input>; }
            set { SetValue(inputsProperty, value); }
        }
    }
}